﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NetCoreCMS.Common;
using NetCoreCMS.IServices;

namespace NetCoreCMS.Web.Areas.Web.Controllers
{
    public class FeedBackController : BaseController
    {
        public int page = 1;         //当前页码
        public int totalcount = 0;   //OUT数据总数
        public IFeedbackService _feedback { get; set; }
        public IActionResult Index()
        {
            int.TryParse(Request.Query["page"], out page);
            page = page > 0 ? page : 1;
            string strwhere = "where is_lock=0";
            var list = _feedback.GetList(page, 50, strwhere, "add_time desc,id desc");
            totalcount = _feedback.RecordCount(strwhere);
            string pageUrl = Utils.CombUrlTxt("/Web/Feedback/Index", "page={0}", "__id__");
            ViewBag.pagelist = Utils.OutPageList(50, page, totalcount, pageUrl, 8);
            return View(list);
        }
    }
}